package site.marqstree.kotlin.library.good.ui.fragment.category.centent.recyclerview.provider

import android.view.View
import com.chad.library.adapter.base.entity.node.BaseNode
import com.chad.library.adapter.base.provider.BaseNodeProvider
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import site.marqstree.kotlin.library.good.R
import site.marqstree.kotlin.library.good.ui.fragment.category.centent.bean.CategoryContentBean


/*
 * 项目名: KotlinMall
 * 包名: site.marqstree.kotlin.library.good.ui.fragment.category.centent.recyclerview
 * 文件名: RootNodeProvider
 * 创建者: marqstree
 * 创建时间: 2020/3/7 15:11
 * 描述: TODO
 */
class RootNodeProvider : BaseNodeProvider() {

    override val itemViewType: Int
        get() = 0

    override val layoutId: Int
        get() = R.layout.category_content_section_head

    override fun convert(
        helper: BaseViewHolder,
        data: BaseNode
    ) {
        val entity: CategoryContentBean = data as CategoryContentBean
        helper.setText(R.id.header, entity.section)
    }

    override fun onClick(
        helper: BaseViewHolder,
        view: View,
        data: BaseNode,
        position: Int
    ) {
        getAdapter()!!.expandOrCollapse(position)
    }
}